package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.domain.NursingProject;
import com.zzyl.nursing.service.INursingProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "用户端护理项目的接口")
@RestController
@RequestMapping("/member/orders/project/")
public class MemberNursingProjectController {

    @Autowired
    private INursingProjectService nursingProjectService;

    @ApiOperation("分页查询护理项目列表")
    @GetMapping("/page")
    public TableDataInfo<NursingProject> selectNursingProjectByPage(Integer pageNum, Integer pageSize, Integer status, String name) {
        TableDataInfo<NursingProject> tableDataInfo = nursingProjectService.selectNursingProjectByPage(pageNum, pageSize, status, name);
        tableDataInfo.setCode(200);
        tableDataInfo.setMsg("查询成功");
        return tableDataInfo;
    }

    @ApiOperation("根据id查询单个")
    @GetMapping("/{id}")
    public R<NursingProject> selectNursingProjectById(@PathVariable Long id) {
        NursingProject nursingProject = nursingProjectService.selectNursingProjectById(id);
        return R.ok(nursingProject);
    }
}
